package part18;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;

/**
 * @author wcj
 * @Date 2021/6/3 17:37
 * @Version 1.0
 */
public class Part1811 {
    static String file = "./src/part18/Part1811.out";

    /**
     * 这是典型应用之四的快捷方式，我们不需要去额外创建输出缓冲，我们直接将文件名当参数放入到PrintWriter的构造器中即可
     *
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new StringReader(Part187.read("./src/part18/Part1811.java")));
        PrintWriter out = new PrintWriter(file);
        int lineCount = 1;
        String s;
        while ((s = in.readLine()) != null) {
            out.println(lineCount++ + ":" + s);
        }
        out.close();
        System.out.println(Part187.read(file));
    }
}
